#!/usr/bin/perl

use strict;
use Data::Dumper;

sub check_table($)
{
    my $table_file = shift;

    open DEVTABLE, $table_file || die "Cannot open file $table_file\n";

    my %msa;
    while (<DEVTABLE>) {
        chomp;
        my ($uuid, $model, $enclosure, $mntpt, $name) = split /\s+/;
        my ($wwn, $lun) = split /:/, $enclosure;
        $msa{$wwn}[$lun] = "$mntpt/$name";
#        if ($name =~ /DB/) {push @{$msa{$wwn}->{TSE}}, "$mntpt/$name"};
#        if ($name =~ /AU/) {push @{$msa{$wwn}->{ASE}}, "$mntpt/$name"};
    }
    close(DEVTABLE);

    print "$table_file\n";
    print Dumper(\%msa);
}

for my $devtable (@ARGV) {
    check_table($devtable);
}
